<template>
  <div>

    <ul>
      <router-link to="/contacts/all"> <li>All contacts</li></router-link>
      <router-link to="/contacts/alice"> <li>Alice</li></router-link>
      <router-link to="/contacts/bob"> <li>Bob</li></router-link>
    </ul>
   <button @click="skip" >点击 </button>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
     data(){
          return{
            arr:['all','alice','bob'],
          }
     },
     methods:{
      skip(){
        const i=Math.floor(Math.random()*this.arr.length)
        this.$router.push({
          path:'/contacts/'+this.arr[i]
        })
      }
     }
}
</script>

<style>

</style>